package com.dream.model.master;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.dream.model.app.AppCodeItem;
import com.dream.model.base.AppUserModelBase;

@Entity
@Table(name="t_mst_product_part")
public class ProductPart extends AppUserModelBase implements Serializable {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4122438920578529511L;

	@Id
	private String id ;

	@Column(name="name")
	private String name;
	
	@Column(name="make_type")
	private Long makeType;
	
	@Column(name="level")
	private Long level;
	
	@Column(name="cost_price")
	private Float costPrice =0f;
	
	@Column(name="cneter_price")
	private Float centerPrice=0f;
	
	@Column(name="net_price")
	private Float netPrice=0f;
	
	@Column(name="customer_price")
	private Float customerPrice=0f;
	
	@Column(name="is_back")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private Boolean isBack = false;
	
	@Column(name="is_over")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private Boolean isOver = false;
	
	@Column(name="is_buy")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private Boolean isBuy = false;
	
	@Column(name="is_relative")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private Boolean isRelative = false;
	
	@Column(name="repair_month")
	private Integer repairMonth = 0;
	
	@Column(name="keyword")
	private String keyword;
	
	@Column(name="comments")
	private String comments;
	
	@Column(name="deleted")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private Boolean deleted = false;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="make_type",updatable=false,insertable=false)
	private AppCodeItem makeTypeObj;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="level",updatable=false,insertable=false)
	private AppCodeItem levelObj;
	
	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public AppCodeItem getMakeTypeObj() {
		return makeTypeObj;
	}

	public void setMakeTypeObj(AppCodeItem makeTypeObj) {
		this.makeTypeObj = makeTypeObj;
	}

	public AppCodeItem getLevelObj() {
		return levelObj;
	}

	public void setLevelObj(AppCodeItem levelObj) {
		this.levelObj = levelObj;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getMakeType() {
		return makeType;
	}

	public void setMakeType(Long makeType) {
		this.makeType = makeType;
	}

	public Long getLevel() {
		return level;
	}

	public void setLevel(Long level) {
		this.level = level;
	}

	public Float getCostPrice() {
		return costPrice;
	}

	public void setCostPrice(Float costPrice) {
		this.costPrice = costPrice;
	}

	public Float getCenterPrice() {
		return centerPrice;
	}

	public void setCenterPrice(Float centerPrice) {
		this.centerPrice = centerPrice;
	}

	public Float getNetPrice() {
		return netPrice;
	}

	public void setNetPrice(Float netPrice) {
		this.netPrice = netPrice;
	}

	public Float getCustomerPrice() {
		return customerPrice;
	}

	public void setCustomerPrice(Float customerPrice) {
		this.customerPrice = customerPrice;
	}

	public Boolean getIsBack() {
		return isBack;
	}

	public void setIsBack(Boolean isBack) {
		this.isBack = isBack;
	}

	public Boolean getIsOver() {
		return isOver;
	}

	public void setIsOver(Boolean isOver) {
		this.isOver = isOver;
	}

	public Boolean getIsBuy() {
		return isBuy;
	}

	public void setIsBuy(Boolean isBuy) {
		this.isBuy = isBuy;
	}

	public Boolean getIsRelative() {
		return isRelative;
	}

	public void setIsRelative(Boolean isRelative) {
		this.isRelative = isRelative;
	}

	public Integer getRepairMonth() {
		return repairMonth;
	}

	public void setRepairMonth(Integer repairMonth) {
		this.repairMonth = repairMonth;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ProductPart other = (ProductPart) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
}
